package com.niodata.dp.task.service.impl;

import com.niodata.dp.task.dao.TaskMonitorConfigMapper;
import com.niodata.dp.task.entity.TaskMonitorConfig;
import com.niodata.dp.task.service.TaskMonitorConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("taskMonitorConfigServiceImpl")
@Transactional
public class TaskMonitorConfigServiceImpl implements TaskMonitorConfigService {

  @Autowired
  private TaskMonitorConfigMapper taskMonitorConfigMapper;

  @Override
  public void createTaskMonitorConfig(TaskMonitorConfig taskMonitorConfig) throws Exception {
    taskMonitorConfigMapper.saveTaskMonitorConfig(taskMonitorConfig);
  }

  @Override
  public void updateTaskMonitorConfig(TaskMonitorConfig taskMonitorConfig) throws Exception {
    taskMonitorConfigMapper.updateTaskMonitorConfig(taskMonitorConfig);

  }

  @Override
  public void deleteByTaskName(String taskName) {
    taskMonitorConfigMapper.deleteTaskMonitorConfig(taskName);
  }

  @Override
  public TaskMonitorConfig getByTaskName(String taskName) {
    return taskMonitorConfigMapper.getTaskMonitorByTaskName(taskName);
  }


}
